import { registerControlProvider } from '@ibiz-template/runtime';
import { withInstall } from '@ibiz-template/vue3-util';
import { App } from 'vue';
import { OdooOrgTreeControl } from './odoo-org-tree';
import { OdooOrgTreeProvider } from './odoo-org-tree.provider';

export const IBizOdooOrgTreeControl = withInstall(
  OdooOrgTreeControl,
  function (v: App) {
    v.component(OdooOrgTreeControl.name, OdooOrgTreeControl);
    registerControlProvider(
      'TREE_RENDER_ODOO_ORG_TREE',
      () => new OdooOrgTreeProvider(),
    );
  },
);

export default {
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
  install(app: App) {
    app.use(IBizOdooOrgTreeControl);
  },
};
